<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>AUI快速完成布局</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <style>
        .warp-count {
            border: 1px solid #ccc;
            text-align: center;
            font-size: 0.6rem;
            /*width: 120px;*/
            margin: .2rem .3rem;
            height: 1.5rem;
            line-height: 1.5rem;
            border-radius: .4rem;
        }
    </style>


</head>

<body>


    <div class="aui-content" style="background-color:#fff;margin-bottom:0.225rem;">
        <div class="aui-row" id="nav-1">
            <div class="aui-col-xs-4 " tapmode onclick="fnSetNavMenuIndex(this);" style="padding:0px;" data-id="#task-ing-1" data-index="1">
                <div class="warp-count" style="border-color:#ff4285;color:#ff4285" ;>
                    已通过待领取
                </div>
            </div>
            <div class="aui-col-xs-4 " tapmode onclick="fnSetNavMenuIndex(this);" style="padding:0px;" data-id="#task-ing-2" data-index="2">
                <div class="warp-count">

                    订单号审核中
                </div>

            </div>
            <div class="aui-col-xs-4 " tapmode onclick="fnSetNavMenuIndex(this);" style="padding:0px;" data-id="#task-ing-3" data-index="3">
                <div class="warp-count">

                    已下单待提交报告
                </div>
            </div>
            <div class="aui-col-xs-4" tapmode onclick="fnSetNavMenuIndex(this);" style="padding:0px;" data-id="#task-ing-4" data-index="4">
                <div class="warp-count">

                    试用报告审核中
                </div>
            </div>
            <div class="aui-col-xs-4 " tapmode onclick="fnSetNavMenuIndex(this);" style="padding:0px;" data-id="#task-ing-5" data-index="5">

                <div class="warp-count">
                    待修改订单号/报告
                </div>
            </div>
            <div class="aui-col-xs-4" tapmode onclick="fnSetNavMenuIndex(this);" style="padding:0px;" data-id="#task-ing-6" data-index="6">
                <div class="warp-count">

                    申诉中
                </div>
            </div>
        </div>
    </div>

    <div id="tab1-con">
        <div id="task-ing-1">

        </div>
        <div id="task-ing-2" class="aui-hide">

        </div>
        <div id="task-ing-3" class="aui-hide">

        </div>
        <div id="task-ing-4" class="aui-hide">


        </div>
        <div id="task-ing-5" class="aui-hide">


        </div>
        <div id="task-ing-6" class="aui-hide">

        </div>
    </div>

</body>
<script type="text/template" id="template1">
    {{~it:value:index}}
    <ul class="aui-list aui-media-list" style="margin-bottom:0.225rem;" onclick="fnOpenSheet(this)" data-index="1">
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-row">

                    <div class="aui-col-xs-12 time51">
                        待商家审核资格倒计时：<span style="color:red"></span>
                        <input type="hidden" value="{{=value.wait_audit_time}}" class="timeNum">
                    </div>
                </div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-media-list-item-inner">
                <div class="aui-list-item-media" style="width:8rem;height:8rem">
                    <img src="{{= fnSiteUrl(value.thumb)}}" style="width:8rem;height:8rem">
                </div>
                <div class="aui-list-item-inner" style="width:10rem">
                    <div class="aui-list-item-text">
                        <div class="aui-list-item-title" style="white-space: nowrap;text-overflow:ellipsis;overflow:hidden;">{{= value.title}}</div>
                    </div>
                    <div class="aui-list-item-text">
                        <p>Id:{{= value.goods_id}}</p>
                        <input type="hidden" class="orderid" value="{{= value.oid}}">
                    </div>
                    <div class="aui-list-item-text">
                        <p>申请: <span>{{=userDate(value.create_time)}}</span></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>试用价: <span style="color:red">{{= value.agoods_price }}</span></p>
                        <p>返：<span style="color:red">{{= value.agoods_price }}</span></p>

                    </div>
                    <div class="aui-list-item-text">
                        <p>旺号:{{= value.account }}</p>


                    </div>
                    <div class="aui-list-item-text">
                        <p>等级：<img src="{{= fnSiteUrl(value.account_level)}}" alt="" style="display:inline;"></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>状态:已通过待领取</p>
                        <p style="color:#fff;background:#ff4285;padding:0.125rem;border-radius:5px;">点击操作</p>
                    </div>
                </div>
            </div>
        </li>
    </ul>
    {{~}}
</script>
<script type="text/template" id="template2">
    {{~it:value:index}}
    <ul class="aui-list aui-media-list" style="margin-bottom:0.225rem;" onclick="fnOpenSheet(this)" data-index="2">
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-row">

                    <div class="aui-col-xs-12 time52">
                        待商家审核资格倒计时：<span style="color:red"></span>
                        <input type="hidden" value="{{=value.wait_audit_time}}" class="timeNum">
                    </div>
                </div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-media-list-item-inner">
                <div class="aui-list-item-media" style="width:8rem;height:8rem">
                    <img src="{{= fnSiteUrl(value.thumb)}}" style="width:8rem;height:8rem">
                </div>
                <div class="aui-list-item-inner" style="width:10rem">
                    <div class="aui-list-item-text">
                        <div class="aui-list-item-title" style="white-space: nowrap;text-overflow:ellipsis;overflow:hidden;">{{= value.title}}</div>
                    </div>
                    <div class="aui-list-item-text">
                        <p>Id:{{= value.goods_id}}</p>
                        <input type="hidden" class="orderid" value="{{= value.oid}}">
                    </div>
                    <div class="aui-list-item-text">
                        <p>申请: <span>{{=userDate(value.create_time)}}</span></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>试用价: <span style="color:red">{{= value.agoods_price }}</span></p>
                        <p>返：<span style="color:red">{{= value.agoods_price }}</span></p>

                    </div>
                    <div class="aui-list-item-text">
                        <p>旺号:{{= value.account }}</p>


                    </div>
                    <div class="aui-list-item-text">
                        <p>等级：<img src="{{= fnSiteUrl(value.account_level)}}" alt="" style="display:inline;"></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>状态:订单号审核中</p>
                        <p style="color:#fff;background:#ff4285;padding:0.125rem;border-radius:5px;">点击操作</p>
                    </div>
                </div>
            </div>
        </li>
    </ul>
    {{~}}
</script>
<script type="text/template" id="template3">
    {{~it:value:index}}
    <ul class="aui-list aui-media-list" style="margin-bottom:0.225rem;" onclick="fnOpenSheet(this)" data-index="3" good-name="{{= value.title}}">
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-row">

                    <div class="aui-col-xs-12 time53">
                        待商家审核资格倒计时：<span style="color:red"></span>
                        <input type="hidden" value="{{=value.wait_audit_time}}" class="timeNum">
                    </div>
                </div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-media-list-item-inner">
                <div class="aui-list-item-media" style="width:8rem;height:8rem">
                    <img src="{{= fnSiteUrl(value.thumb)}}" style="width:8rem;height:8rem">
                </div>
                <div class="aui-list-item-inner" style="width:10rem">
                    <div class="aui-list-item-text">
                        <div class="aui-list-item-title" style="white-space: nowrap;text-overflow:ellipsis;overflow:hidden;">{{= value.title}}</div>
                    </div>
                    <div class="aui-list-item-text">
                        <p>Id:{{= value.goods_id}}</p>
                        <input type="hidden" class="orderid" value="{{= value.oid}}">
                    </div>
                    <div class="aui-list-item-text">
                        <p>申请: <span>{{=userDate(value.create_time)}}</span></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>试用价: <span style="color:red">{{= value.agoods_price }}</span></p>
                        <p>返：<span style="color:red">{{= value.agoods_price }}</span></p>

                    </div>
                    <div class="aui-list-item-text">
                        <p>旺号:{{= value.account }}</p>


                    </div>
                    <div class="aui-list-item-text">
                        <p>等级：<img src="{{= fnSiteUrl(value.account_level)}}" alt="" style="display:inline;"></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>状态:待提交报告</p>
                        <p style="color:#fff;background:#ff4285;padding:0.125rem;border-radius:5px;">点击操作</p>
                    </div>
                </div>
            </div>
        </li>
    </ul>
    {{~}}
</script>
<script type="text/template" id="template4">
    {{~it:value:index}}
    <ul class="aui-list aui-media-list" style="margin-bottom:0.225rem;" onclick="fnOpenSheet(this)" data-index="4">
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-row">

                    <div class="aui-col-xs-12 time54">
                        待商家审核资格倒计时：<span style="color:red"></span>
                        <input type="hidden" value="{{=value.wait_audit_time}}" class="timeNum">
                    </div>
                </div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-media-list-item-inner">
                <div class="aui-list-item-media" style="width:8rem;height:8rem">
                    <img src="{{= fnSiteUrl(value.thumb)}}" style="width:8rem;height:8rem">
                </div>
                <div class="aui-list-item-inner" style="width:10rem">
                    <div class="aui-list-item-text">
                        <div class="aui-list-item-title" style="white-space: nowrap;text-overflow:ellipsis;overflow:hidden;">{{= value.title}}</div>
                    </div>
                    <div class="aui-list-item-text">
                        <p>Id:{{= value.goods_id}}</p>
                        <input type="hidden" class="orderid" value="{{= value.oid}}">
                    </div>
                    <div class="aui-list-item-text">
                        <p>申请: <span>{{=userDate(value.create_time)}}</span></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>试用价: <span style="color:red">{{= value.agoods_price }}</span></p>
                        <p>返：<span style="color:red">{{= value.agoods_price }}</span></p>

                    </div>
                    <div class="aui-list-item-text">
                        <p>旺号:{{= value.account }}</p>

                    </div>
                    <div class="aui-list-item-text">
                        <p>等级：<img src="{{= fnSiteUrl(value.account_level)}}" alt="" style="display:inline;"></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>状态:报告审核中</p>
                        <p style="color:#fff;background:#ff4285;padding:0.125rem;border-radius:5px;">点击操作</p>
                    </div>
                </div>
            </div>
        </li>
    </ul>
    {{~}}
</script>
<script type="text/template" id="template5">
    {{~it:value:index}}
    <ul class="aui-list aui-media-list" style="margin-bottom:0.225rem;" onclick="fnOpenSheet(this)" data-index="5" data-type="{{= value.trial_report_thumb}}">
        <li class="aui-list-item">
            <div class="aui-list-item-inner">
                <div class="aui-row">

                    <div class="aui-col-xs-12 time55">
                        待商家审核资格倒计时：<span style="color:red"></span>
                        <input type="hidden" value="{{=value.wait_audit_time}}" class="timeNum">
                    </div>
                </div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-media-list-item-inner">
                <div class="aui-list-item-media" style="width:8rem;height:8rem">
                    <img src="{{= fnSiteUrl(value.thumb)}}" style="width:8rem;height:8rem">
                </div>
                <div class="aui-list-item-inner" style="width:10rem">
                    <div class="aui-list-item-text">
                        <div class="aui-list-item-title" style="white-space: nowrap;text-overflow:ellipsis;overflow:hidden;">{{= value.title}}</div>
                    </div>
                    <div class="aui-list-item-text">
                        <p>Id:{{= value.goods_id}}</p>
                        <input type="hidden" class="orderid" value="{{= value.oid}}">
                    </div>
                    <div class="aui-list-item-text">
                        <p>申请: <span>{{=userDate(value.create_time)}}</span></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>试用价: <span style="color:red">{{= value.agoods_price }}</span></p>
                        <p>返：<span style="color:red">{{= value.agoods_price }}</span></p>

                    </div>
                    <div class="aui-list-item-text">
                        <p>旺号:{{= value.account }}</p>


                    </div>
                    <div class="aui-list-item-text">
                        <p>等级：<img src="{{= fnSiteUrl(value.account_level)}}" alt="" style="display:inline;"></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>状态:已申请</p>
                        <p style="color:#fff;background:#ff4285;padding:0.125rem;border-radius:5px;">点击操作</p>
                    </div>
                </div>
            </div>
        </li>
    </ul>
    {{~}}
</script>
<script type="text/template" id="template6">
    {{~it:value:index}}
    <ul class="aui-list aui-media-list" style="margin-bottom:0.225rem;" onclick="fnOpenSheet(this)" data-index="6">

        <li class="aui-list-item">
            <div class="aui-media-list-item-inner">
                <div class="aui-list-item-media" style="width:8rem;height:8rem">
                    <img src="{{= fnSiteUrl(value.thumb)}}" style="width:8rem;height:8rem">
                </div>
                <div class="aui-list-item-inner" style="width:10rem">
                    <div class="aui-list-item-text">
                        <div class="aui-list-item-title" style="white-space: nowrap;text-overflow:ellipsis;overflow:hidden;">{{= value.title}}</div>
                    </div>
                    <div class="aui-list-item-text">
                        <p>Id:{{= value.goods_id}}</p>
                        <input type="hidden" class="orderid" value="{{= value.oid}}">
                        <input type="hidden" class="appealid" value="{{= value.id}}">
                    </div>
                    <div class="aui-list-item-text">
                        <p>申请: <span>{{=userDate(value.create_time)}}</span></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>试用价: <span style="color:red">{{= value.agoods_price }}</span></p>
                        <p>返：<span style="color:red">{{= value.agoods_price }}</span></p>

                    </div>
                    <div class="aui-list-item-text">
                        <p>旺号:{{= value.account }}</p>


                    </div>
                    <div class="aui-list-item-text">
                        <p>等级：<img src="{{=fnSiteUrl(value.account_level)}}" alt="" style="display:inline;"></p>
                    </div>
                    <div class="aui-list-item-text">
                        <p>状态:已申请</p>
                        <p style="color:#fff;background:#ff4285;padding:0.125rem;border-radius:5px;">点击操作</p>
                    </div>
                </div>
            </div>
        </li>
    </ul>
    {{~}}
</script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="./conf/config.js"></script>
<script type="text/javascript" src="./js/common.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript">
    apiready = function() {
        fts = "";
        fnGetNum(); //获取各个栏目下面的数量
        fnGetData(1);
        //initRefresh();
    };

    //下拉刷新，松开刷新
    function initRefresh() {
        api.setRefreshHeaderInfo({
            visible: true,
            loadingImg: 'widget://image/refresh.png',
            bgColor: '#ccc',
            textColor: '#fff',
            textDown: '下拉刷新...',
            textUp: '松开刷新...',
            showTime: true
        }, function(ret, err) {
            fnGetData(1);
        });
    }

    function userDate(uData) {
        var myDate = new Date(uData * 1000);
        var year = myDate.getFullYear();
        var month = myDate.getMonth() + 1;
        var day = myDate.getDate();
        var hours = myDate.getHours();
        var minutes = myDate.getMinutes();
        return year + '年' + month + '月' + day + "日" + hours + ":" + minutes;
    }

    function fnUpdateList(ret, num_index) {
        var list = $api.byId('task-ing-' + num_index); //获取节点
        //var str={"array":["banana","apple","orange"]};
        // 1. 编译模板函数
        var tempFn = doT.template($api.byId('template' + num_index).innerHTML); //找到模板多次使用
        // 2. 多次使用模板函数
        var resultText = tempFn(ret.data.list1);
        $api.html(list, "");
        $api.append(list, resultText);
        api.refreshHeaderLoadDone(); //下拉刷新隐藏
        fts = setInterval("fnclock21(" + num_index + ")", 1000);
        fnGetNum();
        //$api.html(list, resultText);
    }

    function fnGetData(num_index) {
        var userInfo = $api.getStorage('userInfo');
        //获取数据app中存入的数据然后分配到模板中；
        if (userInfo) {
            var random = userInfo.random;
            var userid = userInfo.userid;
        } else {
            var random = "";
            var userid = "";
        }
        api.ajax({
            url: SITE_URL + 'index.php?m=api&c=appnew&a=order_apply',
            method: 'post',
            data: {
                values: {
                    userid: userid,
                    random: random,
                    trial: 'trial',
                    state: '2',
                    stat: num_index
                },

            }
        }, function(ret, err) {
            switch (ret.status) {
                case 1:

                    fnUpdateList(ret, num_index);

                    break;
                case 2:
                    alert(ret.msg);
                    api.openWin({
                        name: 'login',
                        url: './login.html',
                        pageParam: {
                            name: 'test'
                        }
                    });

                    //然后关闭当前网页，跳转到另一个网页；
                    break;
                case 5:
                    var html =
                        '<div style="text-align:center;margin:10px;background:#fff;padding:20px;" ><img src="./img/muyou.png" style="display:inline;"><p><span style="font-size:20px;">亲,</span>&nbsp;&nbsp;&nbsp;&nbsp;您当前木有对应的试用品</p></div>';

                    $("#task-ing-" + num_index).html(html);


                    break;
            }
            //alert(JSON.stringify(ret));

        });
    }

    function fnSetNavMenuIndex(that) {
        $(that).find("div").css({
            "color": "#ff4285",
            "border-color": "#ff4285"
        });
        $(that).siblings().find("div").css({
            "border-color": "#ccc",
            "color": "black"
        });
        var dom = $(that).attr("data-id");
        $(dom).removeClass("aui-hide").siblings().addClass("aui-hide");
        var num_index = $(that).attr("data-index");
        clearTimeout(fts);
        fnGetData(num_index);
    }

    function fnOpenSheet(that) {
        var index = $(that).attr("data-index");
        var orderId = $(that).find(".orderid").val();
        var goodName = $(that).attr("good-name");
        var dataType = $(that).attr("data-type"); //如果是1.就是
        switch (index) {
            case '1':
                var btns = ['操作记录', '填写订单号', '撤销申请'];
                var url = ['task_operate_log', 'fill_in_order_number', 'fnRepealApply'];
                api.actionSheet({
                    title: '操作',
                    buttons: btns
                }, function(ret, err) {
                    var sheetIndex = ret.buttonIndex;
                    switch (sheetIndex) {
                        case 1:
                            fnOpenWin(url[0], orderId);
                            break;
                        case 2:
                            fnOpenWin(url[1], orderId);
                            break;
                        case 3:
                            fnOpenWin(url[2], orderId, "", index);
                            break;
                    }
                });
                break;
            case '2':
                var btns = ['操作记录', '修改订单号', '撤销申请'];
                var url = ['task_operate_log', 'edit_fill_in_order_number', 'fnRepealApply'];
                api.actionSheet({
                    title: '操作',
                    buttons: btns
                }, function(ret, err) {
                    var sheetIndex = ret.buttonIndex;
                    switch (sheetIndex) {
                        case 1:
                            fnOpenWin(url[0], orderId);
                            break;
                        case 2:
                            fnFullInOrderNumberNow(orderId);
                            //fnOpenWin(url[1], orderId);
                            break;
                        case 3:
                            fnOpenWin(url[2], orderId, "", index);
                            break;
                    }
                });
                break;
            case '3':
                var btns = ['操作记录', '填写试用报告'];
                var url = ['task_operate_log', 'fill_in_the_trial_report'];
                api.actionSheet({
                    title: '操作',
                    buttons: btns
                }, function(ret, err) {
                    var sheetIndex = ret.buttonIndex;
                    switch (sheetIndex) {
                        case 1:
                            fnOpenWin(url[0], orderId);
                            break;
                        case 2:
                            fnOpenWin(url[1], orderId, goodName);
                            break;

                    }
                });
                break;
            case '4':
                var btns = ['操作记录'];
                var url = ['task_operate_log'];
                api.actionSheet({
                    title: '操作',
                    buttons: btns
                }, function(ret, err) {
                    var sheetIndex = ret.buttonIndex;
                    switch (sheetIndex) {
                        case 1:
                            fnOpenWin(url[0], orderId);
                            break;

                    }
                });
                break;
            case '5':
                if (dataType != 0) {
                    var btns = ['操作记录', '修改试用报告', '我要申述'];
                    var url = ['task_operate_log', 'edit_fill_in_the_trial_report', 'appeal_a_case'];
                    api.actionSheet({
                        title: '操作',
                        buttons: btns
                    }, function(ret, err) {
                        var sheetIndex = ret.buttonIndex;
                        switch (sheetIndex) {
                            case 1:
                                fnOpenWin(url[0], orderId);
                                break;
                            case 2:
                                fnOpenWin(url[1], orderId, goodName);
                                break;
                            case 3:
                                fnOpenWin(url[2], orderId, goodName);
                                break;
                        }
                    });
                } else {
                    var btns = ['操作记录', '修改订单号', '我要申诉'];
                    var url = ['task_operate_log', 'edit_fill_in_order_number', 'appeal_a_case'];
                    api.actionSheet({
                        title: '操作',
                        buttons: btns
                    }, function(ret, err) {
                        var sheetIndex = ret.buttonIndex;
                        switch (sheetIndex) {
                            case 1:
                                fnOpenWin(url[0], orderId, goodName);
                                break;
                            case 2:
                                fnFullInOrderNumberNow(orderId);
                                break;
                            case 3:
                                fnOpenWin(url[2], orderId, goodName);
                                break;
                        }
                    });
                }
                break;
            case '6':

                var btns = ['操作记录', '关闭申诉', '查看申诉'];
                var url = ['task_operate_log', 'close_appeal_a_case', 'look_appeal_a_case'];
                api.actionSheet({
                    title: '操作',
                    buttons: btns
                }, function(ret, err) {
                    var sheetIndex = ret.buttonIndex;
                    switch (sheetIndex) {
                        case 1:

                            fnOpenWin(url[0], orderId, goodName);
                            break;
                        case 2:
                            fnCloseAppealACase(orderId);
                            //fnFullInOrderNumberNow(orderId);
                            break;
                        case 3:
                            fnOpenWin(url[2], orderId, goodName);
                            break;
                    }
                });
                break;

        }
    }
    //撤销申请
    function fnRepealApply(orderId) {
        api.confirm({
            title: '提示：',
            msg: "您确定撤销申请吗？",
            buttons: ['确定', '取消']
        }, function(ret, err) {
            var index = ret.buttonIndex;
            if (index == 1) {
                var userInfo = $api.getStorage('userInfo');
                //获取数据app中存入的数据然后分配到模板中；
                var random = userInfo.random;
                var userid = userInfo.userid;
                api.ajax({
                    url: SITE_URL + 'index.php?m=api&c=appnew&a=close_order_sn',
                    method: 'POST',
                    data: {
                        values: {
                            "userid": userid,
                            "random": random,
                            "order_id": orderId,
                        }
                    }
                }, function(ret, err) {

                    if (ret.status == 1) {
                        fnGetData(1);
                    }
                });

            }
        });

    };


    function fnOpenWin(name, orderId, goodName = "", index_num) {
        //alert(name);
        if (name == "fnRepealApply") {

            //alert(111111111);
            fnRepealApply(orderId, index_num);
        } else {
            api.openWin({
                name: name,
                url: './' + name + '.html',
                pageParam: {
                    orderId: orderId,
                    goodName: goodName
                }
            });
        }
        //fnOperateLogWin(orderId);
    }
    //撤销订单号申请
    function fnTaskWithdrawTheClaim() {
        api.confirm({
            title: '提示',
            msg: '关闭后将不能在填写订单号，确定要关闭吗？',
            buttons: ['确定', '取消']
        }, function(ret, err) {
            var index = ret.buttonIndex;
        });
    }

    function fnRepealApply(orderId, index_num) {
        api.confirm({
            title: '提示：',
            msg: "您确定撤销申请吗？",
            buttons: ['确定', '取消']
        }, function(ret, err) {
            var index = ret.buttonIndex;
            if (index == 1) {
                var userInfo = $api.getStorage('userInfo');
                //获取数据app中存入的数据然后分配到模板中；
                var random = userInfo.random;
                var userid = userInfo.userid;
                api.ajax({
                    url: SITE_URL + 'index.php?m=api&c=appnew&a=close_order_sn',
                    method: 'POST',
                    data: {
                        values: {
                            "userid": userid,
                            "random": random,
                            "order_id": orderId,
                        }
                    }
                }, function(ret, err) {

                    if (ret.status == 1) {
                        fnGetData(index_num);
                    }
                });

            }
        });

    };

    function fnFullInOrderNumberNow(orderId) {

        var dialogBox = api.require('dialogBox');
        dialogBox.input({
            keyboardType: 'default',
            texts: {
                title: '修改订单号：',
                placeholder: '请输入修改的订单号',
                leftBtnTitle: '取消',
                rightBtnTitle: '确定'
            },
            styles: {
                bg: '#fff',
                corner: 2,
                w: 300,
                h: 180,
                title: {
                    h: 40,
                    marginT: 20,
                    alignment: 'center',
                    size: 16,
                    color: '#000',

                },
                input: {
                    h: 60,
                    marginLeft: 10,
                    marginRight: 10,
                    textSize: 14,
                    textColor: '#000',
                    borderWidth: 1
                },
                dividingLine: {
                    width: 0.5,
                    color: '#696969'
                },
                left: {
                    bg: 'rgba(0,0,0,0)',
                    color: '#007FFF',
                    size: 12,
                    h: 40
                },
                right: {
                    bg: 'rgba(0,0,0,0)',
                    color: '#007FFF',
                    size: 12,
                    h: 40
                }
            }
        }, function(ret) {
            // var index = ret.buttonIndex;
            // var text = ret.text;
            // if (index == 1) {
            //     //alert(text);
            //     fnSubmitOrderNumber(text, orderId);
            // }
            // api.alert({
            //     msg: JSON.stringify(ret)
            // });
            if (ret.eventType == 'right') {


                fnSubmitOrderNumber(ret.text, orderId);
                //  alert(ret.text);

            }
                var dialogBox = api.require('dialogBox');
                dialogBox.close({
                    dialogName: 'input'
                });
          
        });
        return false;

        //   api.openFrame({
        //     name: 'fill_in_order_number_val_frame',
        //     url: './fill_in_order_number_val_frame.html',
        //     bgColor: 'rgba(0, 0, 0, 0.5)',
        //     rect: {
        //         x: 0,
        //         y: 0,
        //         w: 'auto',
        //         h: 'auto'
        //     },
        //     pageParam: {
        //         name: 'test'
        //     },
        //
        //     bounces: false
        // });
//        api.prompt({
//            title: '修改订单号：',
//            buttons: ['确定', '取消']
//        }, function(ret, err) {
//            var index = ret.buttonIndex;
//            var text = ret.text;
//            if (index == 1) {
//                //alert(text);
//                fnSubmitOrderNumber(text, orderId);
//            }
//        });
    }

    function fnSubmitOrderNumber(text, orderId) {

        var userInfo = $api.getStorage("userInfo");
        //alert(JSON.stringify(userInfo));
        var userid = userInfo.userid;
        var random = userInfo.random;
        var order_id = orderId;

        api.ajax({
            url: SITE_URL + 'index.php?m=api&c=appnew&a=fill_order_sn',
            method: 'POST',
            data: {
                values: {
                    "userid": userid,
                    "random": random,
                    "order_id": order_id,
                    "order_sn": text,

                }
            }
        }, function(ret, err) {
            //alert(JSON.stringify(ret));

            switch (ret.status) {
                case 0:
                    alert(ret.msg);
                    //api.refreshHeaderLoadDone(); //下拉刷新隐藏
                    break;
                case 1:

                    api.toast({
                        msg:ret.msg,
                        duration: 2000,
                        location: 'middle'
                    });

                    fnGetData(5);
                    break;
                case 2:
                    alert(ret.msg);
                    api.openWin({
                        name: 'login',
                        url: './login.html',
                        pageParam: {
                            name: 'test'
                        }
                    });

                    //然后关闭当前网页，跳转到另一个网页；
                    break;
                case 5:
                    var html =
                        '<div style="text-align:center;margin:10px;background:#fff;padding:20px;" ><img src="./img/muyou.png" style="display:inline;"><p><span style="font-size:20px;">亲,</span>&nbsp;&nbsp;&nbsp;&nbsp;您当前木有对应的试用品</p></div>';

                    $("#task-ing-" + num_index).html(html);

                    //fnUpdateListDefault();
                    //api.refreshHeaderLoadDone(); //下拉刷新隐藏
                    break;
            }

            // if (ret.status == 1) {
            //     alert("修改订单号成功");
            //     fnGetData(5);
            //
            //     //在别别窗口中打开执行刷新
            // }
        })
    }

    function fnCloseAppealACase(orderId) {
        api.confirm({
            title: '提示：',
            msg: "您确定要关闭申诉吗？",
            buttons: ['确定', '取消']
        }, function(ret, err) {
            var index = ret.buttonIndex;
            if (index == 1) {
                var userInfo = $api.getStorage('userInfo');
                //获取数据app中存入的数据然后分配到模板中；
                var random = userInfo.random;
                var userid = userInfo.userid;
                api.ajax({
                    url: SITE_URL + 'index.php?m=api&c=appnew&a=close_appeal_order',
                    method: 'POST',
                    data: {
                        values: {
                            "userid": userid,
                            "random": random,
                            "oid": orderId,
                        }
                    }
                }, function(ret, err) {
                    //alert(JSON.stringify(ret));
                    switch (ret.status) {
                        case 0:
                            alert(ret.msg);
                            //api.refreshHeaderLoadDone(); //下拉刷新隐藏
                            break;
                        case 1:
                            fnGetData(6);
                            break;
                        case 2:
                            alert(ret.msg);
                            api.openWin({
                                name: 'login',
                                url: './login.html',
                                pageParam: {
                                    name: 'test'
                                }
                            });

                            //然后关闭当前网页，跳转到另一个网页；
                            break;
                        case 5:
                            var html =
                                '<div style="text-align:center;margin:10px;background:#fff;padding:20px;" ><img src="./img/muyou.png" style="display:inline;"><p><span style="font-size:20px;">亲,</span>&nbsp;&nbsp;&nbsp;&nbsp;您当前木有对应的试用品</p></div>';

                            $("#task-ing-" + num_index).html(html);

                            //fnUpdateListDefault();
                            //api.refreshHeaderLoadDone(); //下拉刷新隐藏
                            break;
                    }

                    // if (ret.status == 1) {
                    //     fnGetData(6);
                    // }
                });

            }
        });
    }

    function fnclock21(index) {
        console.log(index);
        $(".time5" + index).each(function() {
            var EndTime = $(this).find(".timeNum").val();
            //alert(EndTime);

            var NowTime = parseInt(EndTime - 1);
            if (NowTime > 0) {
                $(this).find(".timeNum").val(NowTime);
                var E_time = userDate1(NowTime);

                $(this).find("span").html(E_time);
            } else {
                clearTimeout(fts);
            }


        });

    }

    function fnGetNum() {
        var userInfo = $api.getStorage('userInfo');
        //获取数据app中存入的数据然后分配到模板中；
        if (userInfo) {
            var random = userInfo.random;
            var userid = userInfo.userid;
        } else {
            var random = "";
            var userid = "";
        }
        api.ajax({
            url: SITE_URL + 'index.php?m=api&c=appnew&a=task_ing_pending',
            method: 'post',
            data: {
                values: {
                    userid: userid,
                    random: random,

                },

            }
        }, function(ret, err) {
            //alert(JSON.stringify(ret));
            if (ret.status == 1) {
                $("#nav-1").find(".warp-count").eq(0).html("已通过待领取(" + ret.data.pass_num + ")");
                $("#nav-1").find(".warp-count").eq(1).html("订单号审核中(" + ret.data.order_checking_num + ")");
                $("#nav-1").find(".warp-count").eq(2).html("已下单待提交报告(" + ret.data.push_report_num + ")");
                $("#nav-1").find(".warp-count").eq(3).html("试用报告审核中(" + ret.data.report_checking_num + ")");
                $("#nav-1").find(".warp-count").eq(4).html("待修改订单号/报告(" + ret.data.order_edit_num + ")");
                $("#nav-1").find(".warp-count").eq(5).html("申诉中(" + ret.data.appeal_a_case + ")");
            }
        });
    }
</script>

</html>
